using UnityEngine;
using System.Collections;

public class RangedGun : MonoBehaviour {
	
	public GameObject bullet;
	public GameObject player;
	public static int ammo = 100;
	NetworkView netView;
	
	// Use this for initialization
	void Start () 
	{
		netView = player.GetComponent<NetworkView>();
	}
	
	// Update is called once per frame
	void Update () {
			
		if(Input.GetButtonDown("Fire1"))
		{
			if(netView.isMine)
			{
				if(ammo > 0)
				{
					Network.Instantiate(bullet,transform.position,transform.rotation,0);
					ammo--;
				}
			}
		}
	}
}
